package com.cn.steam.iam.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cn.steam.iam.mapper.iam.IamUserRoleMapper;
import com.cn.steam.iam.model.po.IamUserRole;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zjm
 * @date 2021/05/10
 */
@Service
public class IamUserRoleProfileService extends ServiceImpl<IamUserRoleMapper, IamUserRole> {

    public void addUserRoleBatch(List<IamUserRole> userRoleList){
        for(IamUserRole userRole : userRoleList){
            saveOrUpdate(userRole,new QueryWrapper<IamUserRole>().eq("role_id",userRole.getRoleId()).eq("user_id",userRole.getUserId()));
        }
    }
}
